﻿<#include "include/_meta.html">
<title>管理员列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span
            class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r"
                                                   style="line-height:1.6em;margin-top:3px"
                                                   href="javascript:location.replace(location.href);" title="刷新"><i
                class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c">
        系统资源管理
    </div>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
	<span class="l">
		<a href="javascript:;" onclick="resource_add('添加资源','/resources/toResourcesAdd','800','500')"
           class="btn btn-primary radius">
			<i class="Hui-iconfont">&#xe600;</i> 添加资源
		</a>

		<a href="javascript:;" onclick="deleteResources()" class="btn btn-danger radius">
			<i class="Hui-iconfont">&#xe6e2;</i> 批量删除
		</a>			
	</span>
    </div>

    <div style="float:left;">
        <iframe id="resTree" height="700px" scrolling="auto" frameborder="0" src="/resources/toResourcesTree"></iframe>
    </div>
    <div style="float:right;">
        <iframe id="resourceSelect" width="800px" height="700px" scrolling="auto" frameborder="0"
                src="/resources/toResourcesSelect"></iframe>
    </div>

</div>

<#include "include/_footer.html">

<script>
    var deleteResources = function () {
        var iframe = document.getElementById('resourceSelect');//获取那个iframe，也可以用$('#iframe')[0]替代
        var iframeWindow = iframe.contentWindow;//获取iframe里的window对象
        var $c = iframeWindow.$;//获取iframe中的jquery对象
        var checkedNum = $c("input[name='useritem']:checked").length;
        //判断选择项是否为空
        if (checkedNum == 0) {
            layer.msg('请选中要删除的列表项!', {icon: 5, time: 1000});
            return;
        }
        //获取选择项的值
        var checkedVal = "";
        $c("input[name='useritem']:checked").each(function () {
            checkedVal += $(this).val() + ",";
        });

        layer.confirm('确认删除吗？', function () {
            //此处请求后台程序，下方是成功后的前台处理……
            $.ajax({
                type: "POST",
                url: "/resources/delResources",
                data: {
                    "checkedList": checkedVal,
                },
                success: function (msg) {
                    layer.msg('已删除!', {icon: 5, time: 1000});
                    location.replace(location.href);
                }
            });
        });
    }

    /*管理员-增加*/
    function resource_add(title, url, w, h) {
        layer_show(title, url, w, h);
    }


</script>
</body>
</html>